// 定义一个自定义错误类型
#[derive(Debug)]
pub enum CustomError {
    SomeError,
    FfmepgError(String),
}

// 为枚举实现 std::error::Error trait
impl std::error::Error for CustomError {}

// 为枚举实现 Display trait，用于在错误处理中打印错误信息
impl std::fmt::Display for CustomError {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self {
            CustomError::SomeError => write!(f, "Some error occurred"),
            CustomError::FfmepgError(msg) => write!(f, "Ffmpge error occurred: {}", msg),
        }
    }
}
